﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestCenter.Fit
{
    class Program
    {
        static void Main1(string[] args)
        {
           /* double[,] xArray = new double[,]
            {
                
                    { 2.000000 ,-1.000000 , 3.000000,  1.000000},
                    { 4.000000 , 2.000000 , 5.000000,  4.000000},
                    { 1.000000 , 2.000000 , 0.000000 , 7.000000}
            };*/

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            double[] y = new double[] { 29152.3, 47025.3, 86852.3, 132450.6, 200302.3, 284688.1, 396988.3 };
            double[] x = new double[] { 1.24, 2.37, 5.12, 8.12, 12.19, 17.97, 24.99 };

           // double[,] xArray;
            double[] ratio;

            sw.Start();
            ratio = FittingFunct.Linear(y, x);
            sw.Stop();

            foreach (double num in ratio)
            {
                Console.WriteLine(num);
            }
            Console.WriteLine("一次拟合计算时间：");
            Console.WriteLine(sw.ElapsedMilliseconds);

            sw.Start();
            ratio = FittingFunct.LOGEST(y, x);
            sw.Stop();

            foreach (double num in ratio)
            {
                Console.WriteLine(num);
            }
            Console.WriteLine("对数拟合计算时间：");
            Console.WriteLine(sw.ElapsedMilliseconds);

            sw.Start();
            ratio=FittingFunct.PowEST(y,x);
            sw.Stop();

             foreach (double num in ratio)
            {
                Console.WriteLine(num);
            }
            Console.WriteLine("指数函数拟合计算时间：");
            Console.WriteLine(sw.ElapsedMilliseconds);

            sw.Start();
            ratio = FittingFunct.IndexEST(y, x);
            sw.Stop();
            foreach (double num in ratio)
            {
                Console.WriteLine(num);
            }
            Console.WriteLine("幂级数拟合计算时间：");
            Console.WriteLine(sw.ElapsedMilliseconds);

            Console.ReadKey();
       
        }
    }
}
